package com.holly.unit.deform.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 布局元素枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/8/4 11:29
 */
public enum LayoutElementEnum {

    /** 栅格布局*/
    GRID("grid"),

    /** 表格布局*/
    REPORT("report"),

    /** 标签页*/
    TABS("tabs"),

    /** 分割线*/
    DIVIDER("divider"),

    /** 行内布局*/
    INLINE("inline"),

    /**折叠面板*/
    COLLAPSE("collapse"),
    /**提示*/
    ALERT("alert");

    String fieldName;

    LayoutElementEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static LayoutElementEnum of(String fieldName) {
        return Stream.of(LayoutElementEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(GRID);
    }


}
